package mywebapps.security.dao;

import java.util.List;

import mywebapps.security.model.Role;

/**
 * This is the DAO interface for CRUD operations on user roles.
 * @author Paul Rivera
 *
 */
public interface UserRoleDao {
    /**
     * This returns all roles assigned to the user.
     * @param userId The user id.
     * @return An array containing all roles assigned to the user.
     */
    Role[] getUserRoles(int userId);

    /**
     * This updates the roles of the user.  It deletes the user's old roles
     * and adds all roles contained in newRoles to the user.
     * @param userId The user id.
     * @param newRoles A list containing the new roles of the user.
     */
    void updateUserRoles(int userId, List<Integer> newRoles);
}
